from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
from sklearn.tree import DecisionTreeClassifier


if __name__ == '__main__':
    iris = load_iris()
    X = iris.data
    y = iris.target
    X_train, X_test, y_train, y_test = train_test_split(X, y, random_state=0)

    clf = DecisionTreeClassifier(max_leaf_nodes=3, random_state=0)
    clf.fit(X_train, y_train)
    # print(dir(clf))
    print(dir(clf.tree_))
    print(clf.tree_.children_left)
    print(clf.tree_.children_right)
    print(clf.tree_.feature)
    print(clf.tree_.threshold)
    print(clf.tree_.n_node_samples)
